//
//  AppDelegate.m
//  Mutal
//
//  Created by TonyStart on 16/10/18.
//  Copyright © 2016年 com.wx. All rights reserved.
//

#import "AppDelegate.h"
#import "SCMainTabBar.h"
#import "SCUserInfo.h"
@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    SCMainTabBar *mainTabBarController = [[SCMainTabBar alloc] init];
    //设置navigationBar 和tabBar 如果设置成no，则状态栏及导航样不为透明的，界面上的组件就是紧挨着导航栏显示了，所以就不需要让第一个组件在y方向偏离44+20的高度了
//    [[UINavigationBar appearance] setTranslucent:NO];
//    [[UITabBar appearance] setTranslucent:NO];
    [self setupStartInfo];
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.window.rootViewController = mainTabBarController;
//    self.window.backgroundColor = [UIColor redColor];
    [self.window makeKeyAndVisible];

    
    
    
    return YES;
}
-(void)setupStartInfo{
    BOOL isLogin = [[NSUserDefaults standardUserDefaults] boolForKey:@"is_login"];
    if (isLogin) {
        //判断用户信息单例内是否有保存数据
        SCUserInfo *userInfo = [SCUserInfo defaultUser];
        
        if (!userInfo.userInfo) {
            //如果单例内种没有数据 就从Plist中取出来 然后给单例赋值
            NSDictionary *userInfo = [NSDictionary dictionaryWithContentsOfFile:[NSHomeDirectory() stringByAppendingString:@"/Documents/userInfo.plist"]];
            [SCUserInfo defaultUser].userInfo = [SCUserInfoModel userInfoWithDict:userInfo];
            
        }
    }
}


- (void)applicationWillResignActive:(UIApplication *)application {
    
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
    
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
    
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
    
}


- (void)applicationWillTerminate:(UIApplication *)application {
    
}


@end
